% This script generates Figures 6 and 8 in the manuscript.
% Figure 6 plots the Rust Belt's manufacturing employment share in the
% benchmark parameterization and in the data.
% Figure 8 adds the Rust Belt's employment share in three different
% counterfactual experiments to the plot in Figure 6.
%% Load data and model-generated results from benchmark calibration and counterfactual experiments.
clearvars;
cd ..
cd ./quantitative_model
BM = load('solution_model_BM.mat');
Conflict = load('solution_model_CF_no_intl_forces.mat');
Intl = load('solution_model_CF_no_conflict.mat');
Neither = load('solution_model_CF_neither.mat');
cd ..
cd ./replicate_figures
Data = readtable('emp_share_mfg.xlsx','Range','A1:B35');
nRBgoods = BM.nRBgoods;
year = 1950:1:2000;
% Calculate time series:
Emp_share_RB_t.BM = 100.*shiftdim(sum(BM.l_t(1:2,1:nRBgoods,:),[1 2]));
Emp_share_RB_t.Conflict = 100.*shiftdim(sum(Conflict.l_t(1:2,1:nRBgoods,:),[1 2]));
Emp_share_RB_t.Intl = 100.*shiftdim(sum(Intl.l_t(1:2,1:nRBgoods,:),[1 2]));
Emp_share_RB_t.Neither = 100.*shiftdim(sum(Neither.l_t(1:2,1:nRBgoods,:),[1 2]));
%% Figure 6: Rust Belt's Decline in Model and Data
figure(6);
plot(Data.year,Data.rbshare.*100,LineStyle='-',LineWidth = 2,Color='k');
text(1985,36,'Data',FontSize=13,Color='k');
hold on
plot(year,Emp_share_RB_t.BM,LineStyle='--',LineWidth = 2,Color='k');
text(1985,41,'Model',FontSize=13);
xlim([1949 2001]);
xticks(1950:10:2000);
ylim([29 56]);
yticks(30:5:55);
set(gca,'box','off','TickDir','out','FontSize',14);
xline(2001,'k');
yline(56,'k');
ylabel('Rust Belt Employment Share','FontSize',14);
grid on
%% Save Figure 6 in PDF and EPS file formats.
saveas(gcf,'fig6.pdf');
saveas(gcf,'fig6','epsc');
%% Figure 8: Decomposing the Rust Belt's Decline
figure(8);
plot(Data.year,Data.rbshare.*100,LineStyle='-',LineWidth = .25,Color='k');
text(1996,32.5,'Data',FontSize=13,Color='k');
hold on
plot(year,Emp_share_RB_t.BM,LineStyle='-',LineWidth = 2,Color='k');
text(1995,40.5,'Model',FontSize=13,Color='k');
hold on
plot(year,Emp_share_RB_t.Conflict,LineStyle='--',LineWidth = 2,Color='k');
text(1984.75,43.75,'Model, no int''l forces',FontSize=13);
hold on
plot(year,Emp_share_RB_t.Intl,LineStyle=':',LineWidth = 2,Color='k');
text(1987,47.25,'Model, no conflict',FontSize=13);
hold on
plot(year,Emp_share_RB_t.Neither,LineStyle='-.',LineWidth = 2,Color='k');
text(1977.75,50,'Model, no int''l forces or conflict',FontSize=13);
xlim([1949 2001]);
xticks(1950:10:2000);
ylim([29 56]);
yticks(30:5:55);
set(gca,'box','off','TickDir','out','FontSize',14);
xline(2001,'k');
yline(56,'k');
ylabel('Rust Belt Employment Share','FontSize',14);
grid on
hold off
%% Save Figure 8 in PDF and EPS file formats.
saveas(gcf,'fig8.pdf');
saveas(gcf,'fig8','epsc');

